
*Create Log
local file testjfe //EDIT

capture log close
log using "$logs/`file'_$S_DATE.log", replace


use "$data_out/provider_propensity.dta", clear
merge 1:1 pid_pde encdate using "$data_out/promotions.dta", keep(3) nogen keepus(promotion1)
merge 1:1 pid_pde encdate using "$data_out/Discharges.dta", keep(3) nogen keepus(discharge_365 negative_365)
merge 1:1 pid_pde encdate using "$data_out/flags.dta", keep(1 3) nogen keepus(any_flag adverse_flag)



tab provID, gen(judge)
tab dow, gen(day)
tab month, gen(my)







// top 10 hospitals.



foreach dvar of varlist negative_365 promotion1 scripts_365 prov7 day_180 {
foreach clinic of  numlist 41 5 37 29 4 30 20 16 7 14  {
display "`dvar'  `clinic'"
testjfe `dvar' ed_prescription judge* if clinic == `clinic', covariates(my* day*)
*graph export "$plotdir/graph_`clinic'.png", as(png) replace

}
}



